import java.util.Scanner;

/**
 * @version v1.0
 * @author} feige
 * @date 2021-11-29-19:50
 * @description
 */
public class Fibonacci {
    public static void main(String[] args) {
        int a = 1;
        int b = 1;
        int c = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入你要计算斐波那契数列的第几位：");
        int index = scanner.nextInt();
        if (index < 3) {
            c = 1;
        } else {
            for (int i = 3; i <= index; i++) {
                c = a + b;
                a = b;
                b = c;
            }
        }
        System.out.println("结果为："+c);
    }
}
